<?php
	 include("backManager/Recycle.php");
     if(isset($_GET["delId"])){//删除
       $delId=$_GET["delId"];
   	   $isSucc=Recycle::delComtById($delId);
       if($isSucc){
       	  header("location:index.php?targetPhp=recycle/allList.php&showMsg=删除评论成功！");
       }else{
       	   echo "alert('删除失败！')";
       }
     }
	 if(isset($_GET["upId"])){//撤销
       $upId=$_GET["upId"];
   	   $isSucc=Recycle::recComtById($upId);
       if($isSucc){
       	  header("location:index.php?targetPhp=recycle/allList.php&showMsg=撤销评论成功！");
       }else{
       	   echo "alert('撤销失败！')";
       }
	 }
	 
	 if(isset($_GET["delDocId"])){//文章删除
       $delId=$_GET["delDocId"];
   	   $isSucc=Recycle::delDocComtById($delId);
       if($isSucc){
       	  header("location:index.php?targetPhp=recycle/allList.php&showDocMsg=删除文章成功！");
       }else{
       	   echo "alert('删除失败！')";
       }
     }
	 if(isset($_GET["upDocId"])){//文章撤销
       $upId=$_GET["upDocId"];
   	   $isSucc=Recycle::recDocComtById($upId);
       if($isSucc){
       	  header("location:index.php?targetPhp=recycle/allList.php&showDocMsg=撤销文章成功！");
       }else{
       	   echo "alert('撤销失败！')";
       }
	 }

    $comList=Recycle::getCommentList();
	$docsList=Recycle::getDocsList();
?>
<script>
    var K;
	KindEditor.ready(function(Ke) {
		K=Ke;
	});
	function showDailog(delMsg) {
			var dialog = K.dialog({
						width : 500,
						title : '确认是否删除',
						body : '<div style="margin:10px;">确认要彻底删除？</div>',
						closeBtn : {
							name : '关闭',
							click : function(e) {
								dialog.remove();
							}
						},
						yesBtn : {
							name : '确定',
							click : function(e) {
								window.location("index.php?targetPhp=recycle/allList.php&"+delMsg);
							}
						},
						noBtn : {
							name : '取消',
							click : function(e) {
								dialog.remove();
							}
						}
					});
	}
</script>
<div class="rightTop">
	<span>已删除的评论</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <span>
		<?php 
    	    if(isset($_GET['showMsg']))
    	    	echo $_GET['showMsg'];
    	?>
	</span>
</div>
<table class="bodyInside">
	<tr class="tableTitle" width="90%">
	    <th width="6%">id</th>
		<th width="10%">评论者id</th>
		<th width="35%">评论内容</th>
		<th width="10%">被评论文章</th>
		<th width="8%">评论日期</th>
		<th width="8%">评论时间</th>
		<th width="15%">操作</th>
	</tr>
    <?php
      	foreach($comList as $keys=>$comt){ 
		     echo "<tr align='center'>";
		     echo "<td>".$comt->id."</td>";
	         echo "<td>".$comt->userid."</td>";
			 echo "<td>".$comt->content."</td>";
			 echo "<td>".$comt->title."</td>";
			 $dt=$comt->wrtdt;
			 echo "<td>".substr($dt, 0,4)."/".substr($dt, 4,2)."/".substr($dt, 6,2)."</td>";
			 $tm=$comt->wrttm;
			 echo "<td>".substr($tm, 0,2).":".substr($tm, 2,2)."</td>";
			 echo "<td><a href='?targetPhp=recycle/allList.php&upId=".$comt->id."'>撤销</a>&nbsp;&nbsp;";		
			 echo "<a href='javascript:showDailog(\"delId=".$comt->id."\");' class='edit'>删除</a></td>";	
			 echo "</tr>";
	    }
    ?>
</table>
<!--两头渐变透明-->
<HR style="FILTER: alpha(opacity=100,finishopacity=0,style=3)" width="80%" color=#987cb9 SIZE=3>
<!--纺锤形
<HR style="FILTER: alpha(opacity=100,finishopacity=0,style=2)" width="80%" color=#987cb9 SIZE=10>
<!--钢针效果
<HR style="FILTER: progid:DXImageTransform.Microsoft.Glow(color=#987cb9,strength=10)" width="80%" color=#987cb9 SIZE=1>
<!--虚线 
<HR style="border:1 dashed #987cb9" width="80%" color=#987cb9 SIZE=1>
<!--双线
<HR style="border:3 double #987cb9" width="80%" color=#987cb9 SIZE=3>
<!--立体效果
<HR style="FILTER: progid:DXImageTransform.Microsoft.Shadow(color:#987cb9,direction:145,strength:15)" width="80%" color=#987cb9 SIZE=1>
-->
<div class="rightTop">
	<span>已删除的文章</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <span>
		<?php 
    	    if(isset($_GET['showDocMsg']))
    	    	echo $_GET['showDocMsg'];
    	?>
	</span>
</div>
<table class="bodyInside">
	<tr class="tableTitle" width="90%">
	    <th width="6%">id</th>
		<th width="35%">文章标题</th>
		<th width="15%">文章作者</th>
		<th width="15%">操作</th>
	</tr>
    <?php
      	foreach($docsList as $keys=>$doc){ 
		     echo "<tr align='center'>";
		     echo "<td>".$doc->id."</td>";
			 echo "<td>".$doc->title."</td>";
			 echo "<td>".$doc->author."</td>";
			 echo "<td><a href='?targetPhp=recycle/allList.php&upDocId=".$doc->id."'>撤销</a>&nbsp;&nbsp;";	
			 echo "<a href='javascript:showDailog(\"delDocId=".$doc->id."\");' class='edit'>删除</a></td>";
			 echo "</tr>";
	    }
    ?>
</table>
